1. Field of the Invention
The present invention relates to a sound encoder that outputs a sound code acquired by compressing a digital sound signal, such as a musical sound or a voice, into a small volume of information, and a sound decoder that decodes the sound code so as to reproduce a sound signal.
2. Description of the Prior Art
Most prior art sound encoders acquire a plurality of codes having a small volume of information from a sound signal, and multiplex them into a sound code. Most prior art sound decoders demultiplex the sound code into a plurality of codes and decode them so as to reproduce the sound signal.
In a sound encoder and a sound decoder disclosed in “ITU-T Recommendation G.722.” (in September, 1999), a Huffman code is used as a part of codes in order to reproduce an excellent sound signal even when those codes have a small amount of information. Huffman codes are typical variable length codes having a feature that their code length becomes short when they have a frequently used value and becomes long otherwise.
FIG. 10 is a block diagram showing the structure of a prior art sound encoder as disclosed in the above-mentioned reference, and FIG. 11 is a block diagram showing the structure of a prior art sound decoder as disclosed in the above-mentioned reference. In the figures, reference numeral 1 denotes an encoding means for encoding a sound signal, which is the target to be coded, so as to produce and output a plurality of codes (i.e., an envelope code and a plurality of band-by-band codes), and reference numeral 2 denotes a multiplexing unit for multiplexing the plurality of codes output from the encoding means 1 into a multiplexed code and for outputting the multiplexed code as a sound code, reference numeral 3 denotes a demultiplexing means for accepting the sound code from the sound encoder and for demultiplexing the sound code into the plurality of codes (i.e., the envelope code and the plurality of band-by-band codes), and reference numeral 4 denotes a decoding means for decoding the plurality of codes demultiplexed by the demultiplexing means 3 so as to reproduce the sound signal.
Next, a description will be made as to the operation of the prior art sound encoder. The prior art sound encoder performs all processes on a frame-by-frame basis, each frame having a length of 20 ms. When a sound signal is input to the encoding means 1 of the prior art sound encoder, the encoding means 1 performs a modulated lapped transform (MLT) on the sound signal so as to acquire MLT coefficients and divides these MLT coefficients into a plurality of regions. The encoding means 1 then calculates a mean value of the MLT coefficients for each region and encodes an amplitude envelope which consists of a plurality of acquired mean values so as to output the coded amplitude envelope as an envelope code. The encoding means 1 then normalizes the MLT coefficients for each region with a value obtained by decoding the envelope code, quantizes the normalized MLT coefficients for each region, and acquires a fixed length code of length which is fixed for each quantization. The encoding means 1 Huffman-encodes (variable-length encodes) this fixed length code and outputs the acquired variable length code as each band-by-band code. The encoding means 1 further determines and outputs a category code of a fixed length for controlling the quantization stepsize for each region in addition to the envelope code and the plurality of band-by-band codes. However, for simplicity, the detailed explanation of the category code will be omitted hereafter.
When the encoding means 1 outputs the envelope code and the plurality of band-by-band codes, the multiplexing means 2 multiplexes them in a fixed order which is provided in advance and outputs the multiplexed result to the sound decoder as a sound code.
The demultiplexing means 3 of the sound decoder accepts the sound code from the sound encoder and demultiplexes the sound code into a plurality of codes so that they are arranged in the fixed order which is provided in advance and outputs the plurality of codes (i.e., the envelope code and the plurality of band-by-band codes).
When receiving the envelope code and the plurality of band-by-band codes from the demultiplexing means 3, the decoding means 4 decodes the envelope code so as to calculate an amplitude envelope, decodes the plurality of band-by-band codes so as to calculate normalized frequency domain coefficients. By multiplying the value of the amplitude envelope for each region by the normalized frequency domain coefficients for each region, the decoding means 4 denormalize the frequency domain coefficients and performs an Inverse MLT (IMLT) on the denormalized frequency domain coefficients so as to reproduce a sound signal.
FIG. 12 is an explanatory drawing for showing an example of the amplitude envelope generated by the prior art sound encoder. In FIG. 12, the horizontal axis indicates the frequency and the vertical axis indicate the value, i.e., envelope value of the amplitude envelope for each region. The total frequency region of the sound signal which is the target to be coded is divided into fourteen regions, and these fourteen regions starting from the lowest-frequency region are consecutively numbered with numbers in ascending order. The amplitude envelope thus becomes a fourteen-dimensional vector having mean values of the frequency domain coefficients for the fourteen frequency regions as fourteen elements of the vector, and an envelope code is obtained as a result of encoding the amplitude envelope.
FIG. 13 is an explanatory drawing for explaining the structure of the sound code in the case of the amplitude envelope of FIG. 12. The multiplexing means 2 multiplexes the plurality of variable-length codes (i.e., Huffman codes), i.e., the plurality of band-by-band codes respectively provided for the plurality of regions so that the plurality of band-by-band codes are arranged in increasing order of their respective frequencies, after multiplexing the envelope code. When a bit error occurs in the same bit position designated by X as that shown in FIG. 13, the band-by-band code numbered 11 separated by the demultiplexing unit 3 of the sound decoder differs from the original one multiplexed by the sound encoder. Since a Huffman code is used as each of the plurality of band-by-band codes, the code length of the band-by-band code numbered 11 can be erroneously estimated with a considerable probability.
As a result, since the demultiplexing means 3 cannot separate the band-by-band codes numbered 12, 13, and 14, which follows the one numbered 11, from correct locations of the multiplexed code, the following codes separated by the demultiplexing means 15 become erroneous ones. These erroneously decoded regions are hatched in FIGS. 12 and 13. Thus, in the prior art sound encoder and the prior art sound decoder, since band-by-band codes provided for high-frequency regions are often multiplexed fixedly into locations closer to the tail of the multiplexed code, there is a possibility that such band-by-band codes are separated erroneously when an bit error occurs before the locations where they are multiplexed.
Japanese patent application publications No. 9-106299 and 2000-183751 disclose sound encoders and sound decoders different from the above-mentioned prior art example. The prior art sound encoder disclosed in Japanese patent application publication No. 9-106299 encodes only a selected, predetermined number of partial frequency domain coefficients (their respective amplitudes) with a larger value in order to select only the necessary ones from among all samples of frequency domain coefficients into which the sound signal is time-to-frequency domain converted and to encode them with a high degree of efficiency. The encoding of the partial frequency domain coefficients is carried out in such a manner that they are encoded in decreasing order of their values, when encoding the second or later largest coefficient the coefficient encoded immediately before the encoding is decoded, and the second or later largest coefficient is encoded after it is normalized with the decoded coefficient. Information indicating the order in which the partial frequency domain coefficients are to be encoded can be sample numbers which are converted into binary numbers, or a series of sample numbers, which is Huffman encoded, and is transmitted from the sound encoder to the sound decoder.
The prior art sound encoder disclosed in Japanese patent application publication No. 2000-183751 sorts data to be encoded according to a predetermined reference, such as bits of each data to be encoded, or bit sensitivities determined based on data errors, in order to implement changeable bit rate encoding which is synchronized in real time with traffic (or transmission line congestions). The order of sorting data is predetermined to ensure that the data can be transmitted between the encoding side and the decoding side. In other words, the order of sorting data is so fixed as not to vary from frame to frame.
A problem with such a prior art sound encoder and such a sound decoder constructed as above is that since the order in which a plurality of band-by-band codes which are variable length codes is so fixed as not to vary from frame to frame, erroneous demultiplexing can often occur in band-by-band codes provided for high-frequency regions, which are multiplexed in locations closer to the tail of the multiplexed code. Another problem is that since the deterioration in the tone quality of the sound signal increases when band-by-band codes with a larger envelope value are erroneously separated, the deterioration in the tone quality of the sound signal increases due to the occurrence of bit errors when band-by-band codes provided for high-frequency regions have a larger envelope value. In other words, since the multiplexing is not carried out in consideration of the distribution of bit error sensitivities that varies from frame to frame, the deterioration in the tone quality of the sound signal increases due to the occurrence of bit errors.
The prior art sound encoder and the prior art sound decoder disclosed in Japanese patent application publication No. 9-106299, do not has a method of sufficiently preventing the deterioration in the sound signal due to the occurrence of bit errors by using an error correction code, but only has a modified encoding unit. Japanese patent application publication No. 9-106299 discloses a method of adding a code indicating the order in which partial frequency domain coefficients are to be encoded and encoding it by using a Huffman code. The other codes other than the code indicating the order are fixed length codes and therefore the problem of the occurrence of erroneous demultiplexing caused by the existence of variable length codes cannot be solved. If anything, the deterioration in the sound signal due to the occurrence of bit errors increases because of the addition of the code associated with the order in which partial frequency domain coefficients are to be encoded and the encoding of the second or later largest partial frequency domain coefficient after decoding the immediately-encoded partial frequency domain coefficient and normalizing the second or later largest partial frequency domain coefficient with the decoded value.
A problem with prior art sound encoder and prior art sound decoders as disclosed in Japanese patent application publication No. 2000-183751 is that since the sound encoder does not perform multiplexing that reflects the distribution of bit error sensibilities that varies from frame to frame, but only sorts data to be encoded according to a predetermined reference so that they are arranged in a fixed order that does not vary from frame to frame, the deterioration in the sound signal due to the occurrence of bit errors cannot be sufficiently prevented, as in the case of the prior art sound encoder and the prior art sound decoder as shown in FIGS. 10 and 11.